package com.xiaotu.dao.common;

import com.xiaotu.dto.WxUserPhoneDto;
import com.xiaotu.model.TVSubModel;
import com.xiaotu.vo.SwListVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author zhangxiao
 * @create 2021-08-17 20:42
 */
public interface CommonMapper {

    /**
     * 登录时需要返回的信息
     *
     * @param userId
     * @return
     */
    WxUserPhoneDto getWxUserPhoneDto(Integer userId);

    /**
     * 根据剧类型，获取题材
     *
     * @param tvType
     * @return
     */
    List<TVSubModel> getTVSubList(String tvType);


    /**
     * 编剧人才列表
     *
     * @param starName
     * @return
     */
    List<SwListVo> getSwTalentUnionList(@Param("starName") String starName);

    /**
     * 编剧人才列表
     *
     * @param tvType
     * @param subNameArr
     * @param sex
     * @param startAge
     * @param endAge
     * @return
     */
    List<SwListVo> getSwTalentList(@Param("tvType") String tvType, @Param("tvTypeArr") Integer[] tvTypeArr, @Param("subNameArr") String[] subNameArr, @Param("sex") String sex, @Param("startAge") Integer startAge, @Param("endAge") Integer endAge);

    /**
     * 评论审核消息提醒
     */
    @Select("<script>" +
            " SELECT COUNT(1) FROM tab_sw_comment WHERE auth_status = 0 " +
            "</script>")
    Boolean getCommentApproveTip();

    /**
     * 我的信息消息提醒（评价）
     */
    @Select("<script>" +
            " SELECT COUNT(1) FROM tab_msg_tip WHERE is_read = 0 AND tip_type = 1 " +
            "</script>")
    Boolean getMyCommentMsgTip();

    /**
     * 我的信息消息提醒（留言）
     */
    @Select("<script>" +
            " SELECT COUNT(1) FROM tab_msg_tip WHERE is_read = 0 AND tip_type = 2 " +
            "</script>")
    Boolean getMyLeaveMsgTip();

    @Select("<script>" +
            " SELECT " +
            " COUNT( 1 ) myConcernNum  " +
            "FROM " +
            " tab_sw_concern " +
            "WHERE " +
            " concern_user_id = #{userId}  " +
            " AND concern_status = 1 " +
            "</script>")
    Integer getMyConcernNum(Integer userId);

    @Select({"<script>" +
            " SELECT " +
            " COUNT( 1 ) myFansNum  " +
            "FROM " +
            " tab_sw_user t1 " +
            " LEFT JOIN tab_sw_concern t2 ON t1.starid = t2.be_concern_star_id  " +
            "WHERE " +
            " t1.userid = #{userId}  " +
            " AND t2.concern_status = 1; " +
            "</script>"})
    Integer getMyFansNum(Integer userId);

    /**
     * 纠错新消息提醒
     */
    @Select("<script>" +
            " SELECT COUNT(1) FROM tab_sw_error WHERE handle_status = 0 " +
            "</script>")
    Boolean getErrorCorrectionTip();
}
